fix(segmentation): apply modeConfiguration overrides#6051
fix(segmentation): apply modeConfiguration overrides#6051igoroctaviano wants to merge 2 commits into
Conversation
The segmentation mode's modeFactory accepted a modeConfiguration argument but never applied it to the returned mode instance, so modesConfiguration overrides from the app config (e.g. hide, displayName) were silently ignored for this mode. Spread modeConfiguration into the returned object to match the other modes. Co-authored-by: Cursor <cursoragent@cursor.com>
✅ Deploy Preview for ohif-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe ChangesMode Configuration Propagation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
wayfarer3130
left a comment
There was a problem hiding this comment.
Eventually a better merge than ... will be needed, but it works ok for now to just have the direct over-ride of anything specific.
Summary
The
segmentationmode'smodeFactoryaccepts amodeConfigurationargument but never applies it to the returned mode instance. As a result, anymodesConfiguration['@ohif/mode-segmentation']overrides from the app config (such ashide,displayName,routeName, etc.) are silently ignored for this mode.Other modes (e.g.
usAnnotation,tmtv,microscopy,preclinical-4d) already spread...modeConfigurationinto their returned object. This change brings the segmentation mode in line with them.Before this fix, e.g. the following config had no effect on the segmentation mode:
Changes
...modeConfigurationinto the object returned by the segmentationmodeFactory.Test plan
modesConfiguration: { '@ohif/mode-segmentation': { hide: true } }to the app config and confirm the Segmentation mode no longer appears in the mode selector.displayNamefor@ohif/mode-segmentationis reflected in the mode selector.Made with Cursor
Summary by CodeRabbit
Greptile Summary
This PR fixes a bug where the segmentation mode's
modeFactoryaccepted amodeConfigurationargument but never spread it into the returned mode object, causing any app-config overrides (e.g.hide: true, customdisplayName) to be silently ignored....modeConfigurationat the end of the returned object inmodes/segmentation/src/index.tsx, matching the existing pattern used by every other OHIF mode.Confidence Score: 5/5
Safe to merge — a one-line fix that aligns the segmentation mode with the established pattern used by every other mode in the repo.
The change is a single spread operator added at the end of a plain object literal. It defaults to an empty object when no overrides are supplied, so existing behaviour is fully preserved. The same pattern is already in production across multiple other modes.
No files require special attention.
Important Files Changed
...modeConfigurationspread at the end of the object returned bymodeFactory, consistent with all other OHIF modes, so app-config overrides (e.g.hide,displayName) are now applied.Reviews (2): Last reviewed commit: "Merge branch 'master' into fix/segmentat..." | Re-trigger Greptile